package com.infore.dataReceiving.repository;
import java.util.List;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import com.infore.dataReceiving.entity.SpanCheckData;

@Repository
public interface ISpanCheckDataRepository extends JpaRepository<SpanCheckData, String>, JpaSpecificationExecutor<SpanCheckData>  {

	public List<SpanCheckData> findByFactorCodeInAndUpdateFlagIsNullOrderByDataTimeAsc(List<String> factorCodeList);
	
	@Modifying
	@Transactional 
	@Query(nativeQuery = true,value = "UPDATE SPANCHECK_DATA SET UPDATE_FLAG = :flag "
			+ "WHERE SPANCHECK_ID IN (:ids) ")
	int updateSpanCheckData(@Param("flag")String flag, @Param("ids") List<String> ids);
}
